package com.cpimex.epricelite.action;
import java.sql.*;

import javax.naming.InitialContext;

import KC.ModSegApp.UsuarioApp;



public class conexion {
	public static UsuarioApp usuario = null;
	public static Connection conectar( InitialContext context ) throws Exception{
               Connection conn = null; 
		       Class.forName("com.inet.tds.TdsDriver").newInstance();
               while (conn==null){
                    System.out.println("NO HAY CONEXION A Eprice");
                    try{
                    //conn = java.sql.DriverManager.getConnection("jdbc:inetdae7:"+"sdevelop01:1433","sa","admin18");
                   	conn = java.sql.DriverManager.getConnection("jdbc:inetdae7:"+"localhost:1999","EPrice","EPrice");
                    conn.setCatalog("Eprice");
                    System.out.println("SI HAY CONEXION A EPRICE");
                    }catch (Exception e){
                    	e.printStackTrace(System.out);
                    	break;
                    }     
                }                
		return conn;  
	}
	
	public static Connection msConnection(InitialContext context ) throws Exception{
                Connection conn = null;    
                Class.forName("com.inet.tds.TdsDriver").newInstance();
                while (conn==null){
                    System.out.println("NO HAY CONEXION A ACPMODSEG");
                    try{
                    //conn = java.sql.DriverManager.getConnection("jdbc:inetdae7:"+"sdevelop01:1433","sa","admin18");
                    conn = java.sql.DriverManager.getConnection("jdbc:inetdae7:"+"localhost:1999","app","client");
                    conn.setCatalog("ACPModSeg");
                    System.out.println("SI HAY CONEXION A ACPMODSEG");
                    }catch (Exception e){
                    	e.printStackTrace(System.out);
                    	break;
                    }     
                }               
		return conn;
       
	}
}
